<!DOCTYPE html>
<html class="iframe-h">

<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-`Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>网站后台管理模版</title>
    <link rel="stylesheet" type="text/css" href="../../static/admin/layui/css/layui.css"/>
    <link rel="stylesheet" name="el" type="text/css" href="../../static/admin/css/admin.css"/>
    <link rel="stylesheet" href="../../static/admin/element-ui/lib/theme-chalk/index.css">
    <script src="../../static/admin/js/vue.js"></script>
    <script src="../../static/admin/element-ui/lib/index.js"></script>
    <script src="../../static/admin/js/axios-0.18.0.js"></script>
    <script src="../../static/admin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../static/admin/js/common.js" type="text/javascript" charset="utf-8"></script>
</head>

<body>
<div class="wrap-container clearfix" id="app">
    <div class="column-content-detail">
        <div class="layui-form" id="table-list">
            <table class="layui-table" lay-even lay-skin="nob">
                <colgroup>
                    <col width="50">
                    <col class="hidden-xs" width="50">
                    <col class="hidden-xs" width="100">
                    <col class="hidden-xs" width="50">
                    <col class="hidden-xs" width="100">
                    <col class="hidden-xs" width="100">
                    <col class="hidden-xs" width="180">
                    <col class="hidden-xs" width="100">
                    <col width="150">
                </colgroup>
                <thead>
                <tr>
                    <th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></th>
                    <th class="hidden-xs">ID</th>
                    <th>昵称</th>
                    <th>性别</th>
                    <th>标签</th>
                    <th>头像</th>
                    <th>位置</th>
                    <th>查看位置</th>
                    <th>删除用户</th>
                </tr>
                </thead>

                <tr v-for="(userInfo,index) in userInfoList">
                    <td><input type="checkbox" name="" lay-skin="primary" data-id="1"></td>
                    <td>{{userInfo.id}}</td>
                    <td>{{userInfo.nickname}}</td>
                    <td>{{userInfo.gender}}</td>
                    <td>{{userInfo.tags}}</td>
                    <td><img :src="userInfo.avatar" height="80"></td>
                    <td>{{userInfo.city}}</td>
                    <td><a :href="'../../../baiduMap/baiduMapSearch.html?id='+userInfo.id">点击查看</a></td>
                    <td>
                        <div class="layui-inline" @click="deleteById(userInfo.id)">
                            <button class="layui-btn layui-btn-small layui-btn-danger del-btn" data-id="1"
                                    data-url="article-detail.html"><i class="layui-icon">&#xe640;</i></button>
                        </div>
                    </td>
                </tr>


            </table>
            <td style="text-align: center">
                <!--分页组件-->
                <el-pagination
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page="pagination.page"
                        :page-size="pagination.pagesize"
                        layout="prev, pager, next"
                        :total="pagination.counts">
                </el-pagination>
            </td>

        </div>
    </div>
</div>


</body>
<script>
    const app = new Vue({
        el: '#app',
        data: {
            userInfoList: [],
            pagination: {
                page:1,
                pagesize: 10,
                counts: 0
            },

        },
        methods: {
            deleteById(id) {
                axios.get("/deleteById?id=" + id).then(resp => {
                    this.findList()
                })
            },
            findList() {
                axios.get("/findUserInfoList", {
                    params: {
                        pageNum: this.pagination.page,
                        pageSize: this.pagination.pagesize,
                    }
                }).then(resp => {
                    this.pagination = resp.data;
                    console.log(this.pagination);

                    this.userInfoList = resp.data.items;
                    console.log(this.userInfoList)
                })
            },
            //当前页改变时调用的方法
            handleCurrentChange(page) {
                //将最新页码赋值给分页对象的当前页码
                this.pagination.page = page;

                //重新发起分页请求
                this.findList();
            },
            //改变每页大小时调用的方法
            handleSizeChange(pagesize) {
                //将最新的每页大爱小赋值给分页对象的当前页码
                this.pagination.pagesize = pagesize;
                //重新发起分页请求
                this.findList();
            },
        },
        created() {
            this.findList()
        }
    })
</script>


</html>